package DataAccess.Storage;

import java.io.Serializable;
import java.io.File;
import java.util.LinkedList;

import DistSys.PersonalInfo;

/**
 * Title:        iPAD
 * Description:
 * Copyright:    Copyright (c) 2002
 * Company:      ABB Inc.
 * @author Fangxing Li
 * @version 1.0
 */

public class PersonalInfoForStorage implements Serializable {
    public static final long serialVersionUID = 100208L;

    protected String  sLookAndFeel;       //look & feel
    protected File    fPathPrj;           //path for PAD\Projects
    protected File    fPathTemp;          //path for PAD\Temp
    protected File    fExtFileExcel;      //external files: EXCEL

    protected File[]  afRecentPrjs;       //recent projects
    protected LinkedList lTempFileList;   //temp file list

    public PersonalInfoForStorage() {}

    public void copyFromPersonalInfo( PersonalInfo pi ){
        this.sLookAndFeel = pi.getLookAndFeelClassName();
        this.fPathPrj   = (File) pi.getPath( PersonalInfo.PATH_PROJECTS);
        this.fPathTemp  = (File) pi.getPath( PersonalInfo.PATH_TEMP);
        this.fExtFileExcel = (File) pi.getExtFile( PersonalInfo.EXT_FILE_EXCEL);
        this.afRecentPrjs = (File[]) pi.getRecentPrjs().clone();
        this.lTempFileList = (LinkedList) pi.getTempFileList().clone();
    }

    public PersonalInfo createPersonalInfoFromThis( ){
        PersonalInfo pi = new PersonalInfo();
        pi.setLookAndFeelClassName( this.sLookAndFeel );
        pi.setPath( PersonalInfo.PATH_PROJECTS,  this.fPathPrj );
        pi.setPath( PersonalInfo.PATH_TEMP,  this.fPathTemp );
        pi.setExtFile(PersonalInfo.EXT_FILE_EXCEL, this.fExtFileExcel );
        pi.setRecentPrjs( this.afRecentPrjs );
        pi.setTempFileList( this.lTempFileList );
        return pi;
    }
}